<?php
require_once('PHPUnit/Framework.php');
require_once("../SMTransmitter/SMTransmitter.class.php");
require_once("../SMTransmitter/Reporter.interface.php");
require_once("../SMTransmitter/CurlReporter.class.php");
require_once("../SMTransmitter/SMMessage.class.php");
require_once("../SMTransmitter/Converter.class.php");

class SMMessagePackageTest extends PHPUnit_Framework_TestCase{
    private $dao=null;

    protected function setUp(){
        $this->dao = new SMMessagePackage("application_key", "transmitter_base_url");
    }

    public function testAddSMMessage(){
        $this->dao->addSMMessage(new SMMessage($errno, $errstr, $errfile, $errline));
        $this->dao->addSMMessage(new SMMessage($errno, $errstr, $errfile, $errline));
        $this->dao->addSMMessage(new SMMessage($errno, $errstr, $errfile, $errline));
        $result = $this->dao->sm_messages;
        $this->assertEquals(count($result), 3, "error: data mangled.");
    }

    public function testGetSMMessages(){
        $this->dao->addSMMessage(new SMMessage($errno, $errstr, $errfile, $errline));
        $this->dao->addSMMessage(new SMMessage($errno, $errstr, $errfile, $errline));
        $this->dao->addSMMessage(new SMMessage($errno, $errstr, $errfile, $errline));
        $result = $this->dao->getSMMessages();
        $this->assertEquals(count($result), 3, "error: data mangled.");
    }

    public function testGetTransmitterBaseUrl(){
        $result = $this->dao->getTransmitterBaseUrl();
        $this->assertEquals($result, "transmitter_base_url", "error: data mangled.");
    }

    public function testGetApplicationKey(){
        $result = $this->dao->getApplicationKey();
        $this->assertEquals($result, "application_key", "error: data mangled.");
    }
}

?>